<?php

include ('../session.php');
include ('../db.php');
include ('config.php');

$output = '';

$output .= "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
  <head>
    <title>Panic Points - List Drops</title>
    <link href=\"../general.css\" rel=\"stylesheet\" type=\"text/css\">
  </head>
  <body>";

include ('navigation.php');

$query = "select drop_id, drops.item_id, item_name, drops.member_id, member_name, raids.location_id, location_name, raids.event_id, event_name, drops.raid_id, drops.item_value, raid_date
          from " . DKP_DROPS . " as drops
          inner join " . DKP_ITEMS . " as items
          on items.item_id = drops.item_id
          inner join "  . DKP_RAIDS . " as raids
          on raids.raid_id = drops.raid_id
          inner join " . DKP_MEMBERS . " as members
          on members.member_id = drops.member_id
          inner join " . DKP_LOCATIONS . " as locations
          on locations.location_id = raids.location_id
          inner join " . DKP_EVENTS . " as events
          on events.event_id = raids.event_id
          order by raid_date desc";
$result = mysql_query ($query);

$output .= "
    <span class=\"listtitle\">drops</span>
    <table class=\"list\" cellspacing=\"0\" cellpadding=\"0\">
      <tr class=\"listheader\">
        <td>date</td>
        <td>buyer</td>
        <td>item</td>
        <td>raid</td>
        <td style=\"text-align: right\">value</td>
      </tr>";

$i = 0;
while ($row = mysql_fetch_array ($result))
{
  $i++;

  $output .= "
      <tr class=\"" . ($i & 1 ? "listodd" : "listeven") . "\">
        <td>" . $row['raid_date'] . "</td>
        <td><a href=\"viewmember.php?memberid=" . $row['member_id'] . "\">" . $row['member_name'] . "</a></td>
        <td><a href=\"viewitem.php?itemid=" . $row['item_id'] . "\">" . $row['item_name'] . "</a></td>
        <td><a href=\"viewraid.php?raidid=" . $row['raid_id'] . "\">" . $row['location_name'] . " - "  . $row['event_name'] . "</a></td>
        <td style=\"text-align: right\">" . $row['item_value'] . "</td>
      </tr>";
}

$output .= "
    </table>";

$output .= "
    <a href=\"adddrop.php\">add drop</a>";
    
$output .= "
  </body>
</html>";

echo $output;

?>
